package com.example.demo.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xlr
 * @since 2022-03-13
 */
@RestController
@RequestMapping("/demo/user")
public class UserController {

    @Autowired
    private UserService userService;


    @GetMapping("list")
    public IPage<User> list() {
        Page<User> page = new Page<>(1, 5);
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.isNotNull("email");
        return userService.page(page, queryWrapper);
    }
}

